from selenium import webdriver
from selenium.webdriver.chrome.service import Service


s=Service(r"/Users/didi1/Desktop/chromedriver.exe")
wb=webdriver.Chrome(service=s)
wb.implicitly_wait(10)
# r:表示后面的路径不存在转译
wb.get('http://cdn1.python3.vip/files/selenium/sample2.html')            # get()打开网址的方法

# 三个切换到内层的方法
# wb.switch_to.frame('frame1')
# wb.switch_to.frame('innerFrame')
wb.switch_to.frame(wb.find_element_by_css_selector('[src="sample1.html"]'))

element=wb.find_elements_by_css_selector('.plant')
for ele in element:
    print(ele.get_attribute('outerHTML'))

wb.switch_to.default_content()              # 切换到外层
wb.find_element_by_id('outerbutton').click()

wb.quit()
